const express = require('express')
const app = express()
const qs = require('Qs')
 app.use((req, res, next) => {
    let str = ''
    req.on('data', (chunk) => {
        str += chunk
    })
    req.on('end', () => {
        const body = qs.parse(str)
        req.body = body
        next()
    })
})
app.use('/user',(req,res)=>{
    console.log('ok');
    res.send(req.body)
})
app.listen(80, () => {
    console.log('http://127.0.0.1');
})






















// const qs = require('Qs')
// app.use((req, res, next) => {
//     let str = ''
//     req.on('data', (chunk) => {
//         str += chunk
//     })
//     req.on('end', () => {
//         const body = qs.parse(str)
//         req.body = body
      
//         next()
//     })
// })
// app.use('/user', (req, res) => {
//     console.log(req.body);
//     res.send(req.body)


// })